#include "Transaction.h"
#include <iomanip>
#include <sstream>
Transaction::Transaction() {

}

string Transaction::getInvoiceNo() {
	return this->invoiceNo;
}

void Transaction::setInvoiceNo(string invoiceNo) {
	this->invoiceNo = invoiceNo;
}

string Transaction::getTDate() {
	return this->tDate;
}

void Transaction::setTDate(string tDate) {
	this->tDate = tDate;
}

string Transaction::getTTime() {
	return this->tTime;
}

void Transaction::setTTime(string tTime) {
	this->tTime = tTime;
}

double Transaction::getTAmount() {
	return this->tAmount;
}

void Transaction::setTAmount(double tAmount) {
	this->tAmount = tAmount;
}

vector<OrderProduct *> Transaction::getOrderLine() 
{
	return orderLine;
}

void Transaction::setOrderLine(vector<OrderProduct *> orderLine)
{
	this->orderLine = orderLine;
}

void  Transaction::TransactionInfo()
{
	cout<< "Invoice No: "<< getInvoiceNo()<<endl;
	cout<< "Date: "<< getTDate()<<endl;
	cout<< "Time: "<< getTTime()<<endl;
	cout << "|"<< setw(14)<<"Pid"<<"|"<< setw(10)<<"Brand"<<"|"<< setw(10)<<"Price"<<"|"<< setw(10)<<"Quantity"<<"|"<< setw(10)<<"Line Amount"<<endl;

	for(int i =0; i< getOrderLine().size();i++)
	{
		cout<<"|" <<setw(14)<<getOrderLine()[i]->getProduct()->getPid();
		cout<<"|" <<setw(10)<<getOrderLine()[i]->getProduct()->getBrand();
		cout<<"|" <<setw(10)<<getOrderLine()[i]->getProduct()->getPrice();
		cout<<"|" <<setw(10)<<getOrderLine()[i]->getQuantity();
		cout<<"|" <<setw(10)<<getOrderLine()[i]->getAmount();
		cout<<endl;
	}

	cout<< "Total Amount: "<< getTAmount()<<endl;


}

